package com.zelix;

import com.sun.kvem.environment.Obfuscator;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.StringTokenizer;

public class ZKMWtkPlugin implements Obfuscator {

    private static final String a = System.getProperty(z(z("mCdT[rOzP\007`^eC")), "\n");
    File b;
    static Class c; /* synthetic field */
    static Class d; /* synthetic field */
    static Class e; /* synthetic field */
    private static String z[];

    public ZKMWtkPlugin() {
    }

    static Class a(String s) {
        try {
            return Class.forName(s);
        }
        catch (ClassNotFoundException classnotfoundexception) {
            throw new NoClassDefFoundError(classnotfoundexception.getMessage());
        }
    }

    public void createScriptFile(File file, File file1) {
        b = file;
        if (b == null)
            throw new IllegalArgumentException(z[2]);
        if (!b.exists())
            throw new IllegalArgumentException(z[3] + b.getAbsolutePath() + z[1]);
    }

    private static void a(Throwable throwable) {
        StringTokenizer stringtokenizer;
        int i;
        int j;
        int l;
        label0:
        {
            String s = px.a(throwable);
            stringtokenizer = new StringTokenizer(s, a);
            i = stringtokenizer.countTokens();
            if (i > 5) {
                j = i - 2;
            } else {
                j = i - 1;
            }
        }
        if (i == 1) {
            System.err.println(stringtokenizer.nextToken());
        } else {
            int k = 0;
            for (; k < i; k++) {
                String s1 = stringtokenizer.nextToken();
                if (k < j && s1.indexOf(z[0]) == -1)
                    System.err.println(s1);
            }
        }
    }

    public void run(File file, String s, String s1, String s2, String s3, String s4, String s5)
            throws IOException {
        label0:
        {
            if (file == null)
                throw new IllegalArgumentException(z[15]);
            if (s2 == null || s2.length() <= 4)
                throw new IllegalArgumentException(z[7] + s2 + "'");
            if (s3 == null || s3.length() < 1)
                throw new IllegalArgumentException(z[18] + s3 + "'");
            if (s4 == null || s4.length() == 0)
                throw new IllegalArgumentException(z[9] + s4 + "'");
            try {
                Class aclass[] = new Class[6];
                aclass[0] = c == null ? (c = a(z[14])) : c;
                aclass[1] = d == null ? (d = a(z[10])) : d;
                aclass[2] = c == null ? (c = a(z[14])) : c;
                aclass[3] = d == null ? (d = a(z[10])) : d;
                aclass[4] = d == null ? (d = a(z[10])) : d;
                aclass[5] = Boolean.TYPE;
                Constructor constructor = (e == null ? (e = a(z[8])) : e).getConstructor(aclass);
                Object aobj[] = new Object[6];
                aobj[0] = b;
                aobj[1] = s2;
                aobj[2] = file;
                aobj[3] = s4;
                aobj[4] = s3;
                aobj[5] = new Boolean(true);
                constructor.newInstance(aobj);
                break label0;
            }
            catch (InstantiationException instantiationexception) {
                System.err.println(z[17]);
                break label0;
            }
            catch (IllegalAccessException illegalaccessexception) {
                System.err.println(z[11]);
                break label0;
            }
            catch (NoClassDefFoundError noclassdeffounderror) {
                System.err.println(z[13] + s4 + "\"");
                System.err.println(z[16]);
                break label0;
            }
            catch (InvocationTargetException invocationtargetexception) {
                Throwable throwable1 = invocationtargetexception.getTargetException();
                if (throwable1 instanceof a1) {
                    System.err.println(z[6] + throwable1.getMessage());
                } else if (throwable1 instanceof z0) {
                    System.err.println(z[12] + throwable1.getMessage());
                } else {
                    a(throwable1);
                    System.err.println(z[5]);
                }
            }
            catch (NoSuchMethodException nosuchmethodexception) {
                System.err.println(z[4]);
            }
            catch (Throwable throwable) {
                a(throwable);
                System.err.println(z[19]);
            }
        }
    }

    private static char[] z(String s) {
        char ac[] = s.toCharArray();
        int clen = ac.length;
        if (clen >= 2)
            return ac;
        ac[0] ^= 0x75;
        return ac;
    }

    private static String z(char ac[]) {
        for (int i = 0; i < ac.length; i++) {
            byte key = 0;
            switch (i % 5) {
                case 0:
                    key = 1;
                    break;
                case 1:
                    key = 0x2a;
                    break;
                case 2:
                    key = 10;
                    break;
                case 3:
                    key = 49;
                    break;
                default:
                    key = 117;
                    break;
            }
            ac[i] ^= key;
        }
        return new String(ac).intern();
    }

    static {
        String as[] = new String[20];
        as[0] = z(z("sOl]\020b^"));
        as[1] = z(z("&\nn^\020r\nd^\001!OrX\006u\004"));
        as[2] = z(z("[aG\013UO_f]UKkN\021\023hFo\037"));
        as[3] = z(z("[aG\013UKkN\021\023hFo\021R"));
        as[4] = z(z("[aG\013UTDoI\005dI~T\021!oxC\032s\n\"t\\/\nZ]\020`Yo\021\007dZeC\001!^bTUqXeS\031dG*E\032!H\177V\006APo]\034y\004i^\030"));
        as[5] = z(z("[aG\013UTDoI\005dI~T\021!oxC\032s\n\"u\\/\nZ]\020`Yo\021\007dZeC\001!^bTUqXeS\031dG*E\032!H\177V\006APo]\034y\004i^\030"));
        as[6] = z(z("DxX~';\nPz8!o|P\031tK~X\032o\nbP\006!OrA\034sOn\013U"));
        as[7] = z(z("[aG\013UHD|P\031hN*X\033q_~\021?@x*W\034mO*_\024lO0\021R"));
        as[8] = z(z("bEg\037\017dFcI[{E"));
        as[9] = z(z("[aG\013UHD|P\031hN*R\031`YyA\024uB0\021R"));
        as[10] = z(z("kK|P[mKdV[R^xX\033f"));
        as[11] = z(z("[aG\013UTDoI\005dI~T\021!oxC\032s\n\"s\\/\nZ]\020`Yo\021\007dZeC\001!^bTUqXeS\031dG*E\032!H\177V\006APo]\034y\004i^\030"));
        as[12] = z(z("[aG\013U"));
        as[13] = z(z("[aG\013UBFkB\006qK~YUhY0\021W"));
        as[14] = z(z("kK|P[hE$w\034mO"));
        as[15] = z(z("[aG\013UO_f]Un_~A\000u\n@p'!Lc]\020/"));
        as[16] = z(z("[aG\013UTDoI\005dI~T\021!oxC\032s\n\"r\\/\nZ]\020`Yo\021\007dZeC\001!^bTUqXeS\031dG*E\032!H\177V\006APo]\034y\004i^\030"));
        as[17] = z(z("[aG\013UTDoI\005dI~T\021!oxC\032s\n\"p\\/\nZ]\020`Yo\021\007dZeC\001!^bTUqXeS\031dG*E\032!H\177V\006APo]\034y\004i^\030"));
        as[18] = z(z("[aG\013UHD|P\031hN*A\007n@oR\001!NcC\020b^eC\f!Dk\\\020;\n-"));
        as[19] = z(z("[aG\013UTDoI\005dI~T\021!oxC\032s\n\"w\\/\nZ]\020`Yo\021\007dZeC\001!^bTUqXeS\031dG*E\032!H\177V\006APo]\034y\004i^\030"));
        z = as;
    }
}
